package com.zmn.oms.common.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * @author sunlife
 * @date:2021/3/22 10:38 上午
 * description:
 */
public class ProductInfoUtil {
    /**
     * productInfo 基本字符串：品牌-产品名*数量
     */
    public static String getProductName(String productInfo) {
        if (StringUtils.isBlank(productInfo)) {
            return "";
        }
        String result = productInfo;
        if (productInfo.contains("-")) {
            result = result.substring(result.indexOf("-") + 1);
        }
        if (productInfo.contains("*")) {
            result = result.substring(0, result.lastIndexOf("*"));
        }
        return result;
    }
}
